class HomeController < ApplicationController
  layout "application"
  
  # ony logged in users can do these axions
  # before_filter :authorize, :except => :index
  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  verify :method => :post, :only => [ :destroy, :create, :update ],
         :redirect_to => { :action => :list }
         
  def index
    render :action => 'home'    
  end

  def lodges
    render :action => 'lodges'    
  end

  def activities
    render :action => 'activities'  
  end
  
  def location
    render :action => 'location'    
  end
  
  def sustentr
    render :action => 'sustentr'    
  end
  
  def voluntarywork
    render :action => 'voluntarywork'    
  end

  def booknow
    render :action => 'booknow'    
  end
  
  def about
    render :action => 'about'
  end
  
  def yourhelp
    render :action => 'yourhelp'
  end
  
  def friends
    render :action => 'friends'
  end
  
  def photos
    
    # declare global variable
    @photos = []
    
    # Check that the dir exists
    if FileTest.directory?(AppConfig.photo_album_dir)

      # iterate through dir. get the thumbnails
      Dir.foreach(AppConfig.photo_album_dir) do |entry|
        
        next if entry == '.' or entry == '..' or not entry.include? '.jpg' or not entry.include? 'thumb_'
          
          @photos << entry.gsub(/thumb_/, '')
          #puts entry.gsub(/thumb_/, '')
          
      end
    end
    
    render :action => 'photos'
  end
    
  def booknow
    render :action => 'booknow'    
  end
  
  def contact
    render :action => 'contact'    
  end
  
end
